package com.zero.basic.dao;

import org.hibernate.SQLQuery;
import org.springframework.stereotype.Repository;

@Repository("sqlUpdateBaseDao")
public class SqlUpdateBaseDao<T> extends DefaultBaseDao<T> {

	public int updateBySql(String sql, Object[] args) {
		SQLQuery query = getSession().createSQLQuery(sql);
		setParameter(query, args);
		return query.executeUpdate();
	}

	public int updateBySql(String sql, Object arg) {
		return this.updateBySql(sql, new Object[] { arg });
	}

	public int updateBySql(String sql) {
		return this.updateBySql(sql, null);
	}
}
